'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {};

modelField.BizRecord = {
    type: Schema.ObjectId,
    ref: 'BizRecord',
    Name: '业务流水记录',
    IsEmpty: false
};

modelField.QCNorm = {
    type: Schema.ObjectId,
    ref: 'QCNorm',
    Name: '质检指标',
    IsEmpty: false
};

modelField.QCStandard = {
    type: Schema.ObjectId,
    ref: 'QCStandard',
    Name: '检验标'
};

modelField.NormValue = {
    type: String,
    trim: true,
    Name: '指标'
};

modelField.StandardValue = {
    type: String,
    trim: true,
    Name: '标准值'
};

modelField.ValueUpperLimit = {
    type: Number,
    trim: true,
    Name: '标准值上限'
};

modelField.ValueLowerLimit = {
    type: Number,
    trim: true,
    Name: '标准值下限'
};

modelField.IsQualified = {
    type: Boolean,
    Name: '合格'
};

modelField.BadPosition = {
    type: Number,
    Name: '不良位置'
};

modelField.BadType = {
    type: Number,
    Name: '不良类型'
};

modelField.Images = {
    type: [{
        type: String,
        trim: true
    }],
    Name: '图片'
};

modelField.Remark = {
    type: String,
    trim: true,
    Name: '备注'
};

var newModel = new Model(modelField);
newModel.addIndex({BizRecord: 1});
newModel.create('QCRecord', '品质记录');
